package com.azusa.xbiao.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

@Entity
@Table(name = "tb_order")
public class Order {
    private int id;
    private int uId;
    private int gId;
    private BigDecimal price;
    private Integer count;
    private String goodsTitle;
    private String goodsImageUrl;
    private String goodsType;
    private Date createDate;
    private Byte arrival;
    private Date arrivalDate;
    private Byte evaluate;
    private Date evaluateDate;

    @Id
    @Column(name = "id", nullable = false)
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "u_id", nullable = false)
    public int getuId() {
        return uId;
    }

    public void setuId(int uId) {
        this.uId = uId;
    }

    @Basic
    @Column(name = "g_id", nullable = false)
    public int getgId() {
        return gId;
    }

    public void setgId(int gId) {
        this.gId = gId;
    }

    @Basic
    @Column(name = "price", nullable = true, precision = 2)
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Basic
    @Column(name = "count", nullable = true)
    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Basic
    @Column(name = "goods_title", nullable = true, length = 255)
    public String getGoodsTitle() {
        return goodsTitle;
    }

    public void setGoodsTitle(String goodsTitle) {
        this.goodsTitle = goodsTitle;
    }

    @Basic
    @Column(name = "goods_image_url", nullable = true, length = 255)
    public String getGoodsImageUrl() {
        return goodsImageUrl;
    }

    public void setGoodsImageUrl(String goodsImageUrl) {
        this.goodsImageUrl = goodsImageUrl;
    }

    @Basic
    @Column(name = "goods_type", nullable = true, length = 255)
    public String getGoodsType() {
        return goodsType;
    }

    public void setGoodsType(String goodsType) {
        this.goodsType = goodsType;
    }

    @Basic
    @Column(name = "create_date", nullable = true)
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Basic
    @Column(name = "arrival", nullable = true)
    public Byte getArrival() {
        return arrival;
    }

    public void setArrival(Byte arrival) {
        this.arrival = arrival;
    }

    @Basic
    @Column(name = "arrival_date", nullable = true)
    public Date getArrivalDate() {
        return arrivalDate;
    }

    public void setArrivalDate(Date arrivalDate) {
        this.arrivalDate = arrivalDate;
    }

    @Basic
    @Column(name = "evaluate", nullable = true)
    public Byte getEvaluate() {
        return evaluate;
    }

    public void setEvaluate(Byte evaluate) {
        this.evaluate = evaluate;
    }

    @Basic
    @Column(name = "evaluate_date", nullable = true)
    public Date getEvaluateDate() {
        return evaluateDate;
    }

    public void setEvaluateDate(Date evaluateDate) {
        this.evaluateDate = evaluateDate;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Order order = (Order) o;

        if (id != order.id) return false;
        if (uId != order.uId) return false;
        if (gId != order.gId) return false;
        if (price != null ? !price.equals(order.price) : order.price != null) return false;
        if (count != null ? !count.equals(order.count) : order.count != null) return false;
        if (goodsTitle != null ? !goodsTitle.equals(order.goodsTitle) : order.goodsTitle != null) return false;
        if (goodsImageUrl != null ? !goodsImageUrl.equals(order.goodsImageUrl) : order.goodsImageUrl != null)
            return false;
        if (goodsType != null ? !goodsType.equals(order.goodsType) : order.goodsType != null) return false;
        if (createDate != null ? !createDate.equals(order.createDate) : order.createDate != null) return false;
        if (arrival != null ? !arrival.equals(order.arrival) : order.arrival != null) return false;
        if (arrivalDate != null ? !arrivalDate.equals(order.arrivalDate) : order.arrivalDate != null) return false;
        if (evaluate != null ? !evaluate.equals(order.evaluate) : order.evaluate != null) return false;
        if (evaluateDate != null ? !evaluateDate.equals(order.evaluateDate) : order.evaluateDate != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + uId;
        result = 31 * result + gId;
        result = 31 * result + (price != null ? price.hashCode() : 0);
        result = 31 * result + (count != null ? count.hashCode() : 0);
        result = 31 * result + (goodsTitle != null ? goodsTitle.hashCode() : 0);
        result = 31 * result + (goodsImageUrl != null ? goodsImageUrl.hashCode() : 0);
        result = 31 * result + (goodsType != null ? goodsType.hashCode() : 0);
        result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
        result = 31 * result + (arrival != null ? arrival.hashCode() : 0);
        result = 31 * result + (arrivalDate != null ? arrivalDate.hashCode() : 0);
        result = 31 * result + (evaluate != null ? evaluate.hashCode() : 0);
        result = 31 * result + (evaluateDate != null ? evaluateDate.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", uId=" + uId +
                ", gId=" + gId +
                ", price=" + price +
                ", count=" + count +
                ", goodsTitle='" + goodsTitle + '\'' +
                ", goodsImageUrl='" + goodsImageUrl + '\'' +
                ", goodsType='" + goodsType + '\'' +
                ", createDate=" + createDate +
                ", arrival=" + arrival +
                ", arrivalDate=" + arrivalDate +
                ", evaluate=" + evaluate +
                ", evaluateDate=" + evaluateDate +
                '}';
    }
}
